
#ifndef _QMC5883_H_
#define _QMC5883_H_

#include "QMC5883_def.h"

/// @brief 初始化qmc5883
/// @param dev
/// @return 成功返回0
int8_t qmc5883_init(qmc5883_dev *dev);

/// @brief 从qmc5883寄存器读出数据
/// @param reg_addr
/// @param data
/// @param len
/// @param dev
/// @return
int8_t qmc5883_get_regs(uint8_t reg_addr, uint8_t *data, uint16_t len, qmc5883_dev *dev);

/// @brief 向qmc5883寄存器写入数据
/// @param reg_addr
/// @param data
/// @param len
/// @param dev
/// @return
int8_t qmc5883_set_regs(uint8_t reg_addr, uint8_t *data, uint16_t len, qmc5883_dev *dev);

/// @brief 对qmc5883进行软复位
/// @param dev
/// @return
int8_t qmc5883_soft_reset(qmc5883_dev *dev);

/// @brief 对qmc5883进行测试
/// @param dev
/// @return
int8_t qmc5883_self_test(qmc5883_dev *dev);

/// @brief 选择qmc5883模式
/// @param mode
/// @param dev
/// @return
int8_t qmc5883_select_mode(enum QMC5883_Mode mode, qmc5883_dev *dev);

/// @brief 读取QMC5883数据
/// @param data
/// @param dev
/// @return
int8_t qmc5883_get_sensor_data(qmc5883_mag_data_t *data, qmc5883_dev *dev);

/// @brief 选择量程
/// @param
/// @param dev
/// @return
int8_t qmc5883_select_range(enum QMC5883_Range range, qmc5883_dev *dev);

/// @brief 选择odr
/// @param
/// @param dev
/// @return
int8_t qmc5883_select_odr(enum QMC5883_odr odr, qmc5883_dev *dev);

/// @brief 选择供电模式
/// @param pwr_mode
/// @param dev
/// @return
int8_t qmc5883_select_pwr_mode(uint8_t pwr_mode, qmc5883_dev *dev);

#endif